<template>
	<view class="categorys">
		<view class="left">
			<image src="/static/icons/notify.png" mode=""></image>
			<view class="text">
				限时活动：
			</view>
		</view>
		<view class="right">
			<swiper class="swiper" :autoplay="true" :interval="2000" :vertical="true" :circular="true">
				<swiper-item v-for="item in dataList" :key="item.recommendId" @tap="toGoodsInfo(item.productId)">
					<view class="swiper-item">
						<view class="name">{{item.name}}</view>
						<view class="price-holder">
							<view class="price-before">
								{{item.promotionPrice}}
							</view>
							<view class="price-now">
								现价：{{item.price}}
							</view>
						</view>
					</view>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	export default {
		props:["dataList"],
		methods: {
			toGoodsInfo(id){
				uni.navigateTo({
					url: `/pages/goodsInfo/goodsInfo?goodsId=${id}`,
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	@keyframes imageFlash{
		0%,100%{
			opacity: 0.5;
		}
		50%{
			opacity:1;
		}
	}
	
	.categorys {
		display: flex;
		margin: 0 auto;
		width: 670rpx;
		height: 96rpx;
		background-color: #fff;

		.left {
			display: flex;
			flex: 1;
			align-items: center;
			justify-content: space-around;
			height: 100%;
			image{
				width: 48rpx;
				height: 48rpx;
				animation: imageFlash 1s infinite;
			}
			.text{
				font-weight: 600;
				color: orange;
			}
		}

		.right {
			width: 458rpx;
			height: 100%;

			.swiper {
				width: 100%;
				height: 100%;

				.swiper-item {
					display: flex;
					align-items: center;
					width: 100%;
					height: 100%;
					.name {
						width: 250rpx;
						height: 100%;
						line-height:96rpx;
						text-overflow: ellipsis;
						white-space: nowrap;
						overflow: hidden;
						font-size: 28rpx;
						color: #3e3e3e;
					}
					.price-holder {
						flex: 1;
						font-size: 24rpx;
						line-height: 30rpx;
						.price-before {
							text-decoration: line-through;
							font-weight: 700;
						}
						.price-now {
							color: #f00;
							font-weight: 700;
						}
					}
				}

			}
		}
	}
</style>
